/*
*
* Copyright (c) 2011 Vaulting Systems International
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy 
* of this software and associated documentation files (the "Software"), to deal 
* in the Software without restriction, including without limitation the rights 
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
* of the Software, and to permit persons to whom the Software is furnished to do  
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all  
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE  
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package com.ekeyman.securesavelib.domain;

import java.io.Serializable;
import java.util.Set;

import com.ekeyman.securesavelib.domain.Resource;


public class User  implements Serializable{
	private static final long serialVersionUID = 297409541049442040L;
	private long id;
	private String openidurl;
	private String username;
	private String emailAddress;
	private int disabled;
	private long version;
	private Set<Resource> resources;
	
	public void setId(long id) {
		this.id = id;
	}
	public long getId() {
		return id;
	}

	public void setOpenidurl(String openidurl) {
		this.openidurl = openidurl.toUpperCase();
	}
	public String getOpenidurl() {
		return openidurl.toUpperCase();
	}
	
	public void setUsername(String username) {
		this.username = username;
	}
	public String getUsername() {
		return username;
	}
	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}
	public String getEmailAddress() {
		return emailAddress;
	}
	public void setDisabled(int disabled) {
		this.disabled = disabled;
	}
	public int getDisabled() {
		return disabled;
	}
	
	public void setVersion(long version) {
		this.version = version;
	}
	public long getVersion() {
		return version;
	}
	public void setResources(Set<Resource> resources) {
		this.resources = resources;
	}
	public Set<Resource> getResources() {
		return resources;
	}
	@Override
	public boolean equals(Object o){
		boolean result = false;
		if (o instanceof User){
			User ap = (User)o;
			if(openidurl.equalsIgnoreCase(ap.getOpenidurl())) {
				result = true;
			}
		}
		return result;
	}
	
	@Override
	public int hashCode(){
		return openidurl.hashCode();
	}

}
